<template>
	<view class="">
		<u-form :model="form" ref="uForm" >
			<u-form-item v-for="(item, index) in list" :label="item.label" >
				<u-input v-model="item.model" />{{ item.model}}
			</u-form-item>
			<u-form-item label="简介">
				<u-input v-model="form.intro" />{{ form.intro}}
			</u-form-item>
			
			<!-- <u-checkbox v-model="item.checked" v-for="(item, index) in checkboxList" :key="index" :name="item.name">
								{{ item.name }}
							</u-checkbox> -->
		</u-form>
		<u-button @click="submit">提交</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					name: '',
					password: ''
				},
				list: [{
						label: '姓名',
						model: 'form.name',
						type: 'input'
					},{
						label: '密码',
						model: 'form.password',
						type: 'input'
					}
				]
			};
		},
		methods: {
			submit() {
				console.log("测试",this.form);
				this.$refs.uForm.validate(valid => {
					if (valid) {
						console.log('验证通过');
					} else {
						console.log('验证失败');
					}
				});
			}
		}
	};
</script>

<style>

</style>
